package com.example.xd.javatest.proxy_test;

import java.lang.reflect.Proxy;

/**
 * @auther XuDan on 2020/6/15.
 */
public class Client {
    public static void main(String[] args) {
        RealSinger sing = new RealSinger();
        StaticProxy proxySide = new StaticProxy(sing);
        proxySide.sing("周杰伦");

        AutoProxy autoProxy = new AutoProxy(sing);
        Sing proxyInstance = (Sing) Proxy.newProxyInstance(autoProxy.getClass().getClassLoader(),
                new Class[]{Sing.class},
                autoProxy);
        proxyInstance.sing("张娜拉");
    }
}
